import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
//导入字体图标
import './assets/fonts/iconfont.css'
//导入全局样式表
import './assets/css/global.css'
import TreeTable from 'vue-table-with-tree-grid'


import axios from 'axios'
//配置请求的根路径   ========   axios的全局配置
axios.defaults.baseURL = 'https://lianghj.top:8888/api/private/v1/'
axios.defaults.timeout = 5000

//axios拦截器（过滤器）
//用于我们在网络请求的时候发起请求或响应时对操作进行响应的处理，发起请求时可以添加网页加载的动画等等
axios.interceptors.request.use(config => {
  console.log('进入请求拦截器!')
  console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  //放行(一定要记得放行)
  return config
}, err => {
  console.log('请求方向失败!')
  console.log(err)
})

Vue.prototype.$http = axios
Vue.config.productionTip = false

Vue.component('tree-table', TreeTable)

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
